package com.link2room.cms.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author sqj88
 * @date 2017/12/1 9:11
 */
@Entity
@Table(name = "cms_base")
@DynamicInsert
public class CmsBase extends BaseEntity{
    public enum CmsBase_{
        categoryCode,parentCode
    }
    private String categoryCode;
    private String parentCode;
    private String groupType;

    @Basic
    @Column(name = "category_code", nullable = false, length = 32)
    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    @Basic
    @Column(name = "parent_code", nullable = false, length = 32)
    public String getParentCode() {
        return parentCode;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    @Basic
    @Column(name = "group_type",  length = 64)
    public String getGroupType() {
        return groupType;
    }

    public void setGroupType(String groupType) {
        this.groupType = groupType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CmsBase cmsBase = (CmsBase) o;

        if (categoryCode != null ? !categoryCode.equals(cmsBase.categoryCode) : cmsBase.categoryCode != null)
            return false;
        return parentCode != null ? parentCode.equals(cmsBase.parentCode) : cmsBase.parentCode == null;
    }

    @Override
    public int hashCode() {
        int result = categoryCode != null ? categoryCode.hashCode() : 0;
        result = 31 * result + (parentCode != null ? parentCode.hashCode() : 0);
        return result;
    }
}
